package Kuaishou;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import org.apache.commons.collections.CollectionUtils;

import com.google.common.collect.Lists;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @author leiwenkang <leiwenkang@kuaishou.com>
 * Created on 2021-06-17
 */
public class Test44Sort {
    public static void main(String[] args) {
        List<MyStudent> students = Lists.newArrayList();
        students.add(new MyStudent(1, 70L));
        students.add(new MyStudent(1, 90L));
        System.out.println(students);
        Collections.sort(students, new Comparator<MyStudent>() {
            @Override
            public int compare(MyStudent o1, MyStudent o2) {
                return Long.compare(o2.getScore(), o1.getScore());
            }
        });

        System.out.println(students);
    }
}

@Data
@AllArgsConstructor
class MyStudent {
    int id;
    long score;
}
